package com.disease.chronic.Service.Impl;

import com.disease.chronic.Exception.ChronicExceptionEnum;
import com.disease.chronic.Global.Result;
import com.disease.chronic.Mappers.AlertHistoryMapper;
import com.disease.chronic.Service.AlertService;
import com.disease.chronic.pojo.AlertHistory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AlertServiceImpl implements AlertService {
    @Autowired
    AlertHistoryMapper alertHistoryMapper;

    @Override
    public void insertAlertRecord(AlertHistory alertHistory) {
        alertHistoryMapper.insert(alertHistory);
    }

    @Override
    public Result getAllAlertRecord(String username) {
        List<AlertHistory> histories = alertHistoryMapper.selectAllAlertHistory(username);
        return new Result(ChronicExceptionEnum.SUCCESS.getCode(),
                ChronicExceptionEnum.SUCCESS.getMessage(),
                histories);
    }
}
